//
//  RealTimeHBFrontController.m
//  CoolTennisBall
//
//  Created by Coollang on 16/8/15.
//  Copyright © 2016年 CoolLang. All rights reserved.
//

#import "RealTimeHBFrontController.h"
#import "MTScatterChart.h"
#import "NSDate+FormateString.h"
#import "RealTimeTrainModel.h"
#import "ChartItem.h"

@interface RealTimeHBFrontController ()
@property (weak, nonatomic) IBOutlet MTScatterChart *frontScatterView;
// 总击球数
@property (weak, nonatomic) IBOutlet UILabel *frontTotalHitBallNumberLabel;

@property (weak, nonatomic) IBOutlet UILabel *frontStandardNumerLabel;
@property (weak, nonatomic) IBOutlet UILabel *frontPassRateLabel;

@property (weak, nonatomic) IBOutlet UILabel *frontShangxuanLabel;
@property (weak, nonatomic) IBOutlet UILabel *frontPingjiLabel;
@property (weak, nonatomic) IBOutlet UILabel *frontXueqiuLabel;

@property (weak, nonatomic) IBOutlet UILabel *frontAverageSpeedLabel;

@end

@implementation RealTimeHBFrontController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 设置散点图参数
    self.frontScatterView.yTitleArray = @[@0, @20, @40, @60, @80, @100, @120, @140];
    
}

- (void)configerForeHandHitBallNum:(NSAttributedString *)hitBallNum StandardNum:(NSAttributedString *)StandardNum passRate:(NSAttributedString *)passRate sPXTexts:(NSDictionary *)sPXTexts averageSpeed:(NSString *)avg dotItems:(NSArray *)dotItems targetSpeed:(CGFloat )targetSpeed {
    
    self.frontTotalHitBallNumberLabel.attributedText = hitBallNum;
    self.frontStandardNumerLabel.attributedText = StandardNum;
    self.frontPassRateLabel.attributedText = passRate;
    
    self.frontShangxuanLabel.text = sPXTexts[@"ShangXuan"];
    self.frontPingjiLabel.text = sPXTexts[@"PingJi"];
    self.frontXueqiuLabel.text = sPXTexts[@"XueQiu"];
    
    self.frontAverageSpeedLabel.text = avg;
    self.frontScatterView.dotItems = dotItems;
    
    self.frontTargetSpeed = targetSpeed;
        [self.frontScatterView updateTargetSpeed:self.frontTargetSpeed withTextString:@"目标拍速"];
    [self.frontScatterView updateScatterDotLayer];
    [self.frontScatterView drawChart];
    
}

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    
    [self.frontScatterView layoutIfNeeded];
    [self.frontScatterView setDefaultValues];
    
    [self.frontScatterView updateTargetSpeed:self.frontTargetSpeed withTextString:@"目标拍速"];
    [self.frontScatterView drawChart];
}


@end
